/*
 *  ASourceClip.cpp
 *  libavid
 *
 *  Created by Peter on 25.02.12.
 *  Copyright 2012 __MyCompanyName__. All rights reserved.
 *
 */

#include "ASourceClip.h"
#include "AStream.h"

A_IMPLEMENT_CLASS( 'SCLP', ASourceClip, AClip );

void ASourceClip::readFromStream( AStream& str, const AObjDoc& objd )
{
	AClip::readFromStream( str, objd );
	
	UInt8 tagMark, version;
	
	str.readPod( tagMark );
	str.readPod( version );
	TR_ASSERT( tagMark == 0x02 );
	TR_ASSERT( version == 0x03 );
	
	str.readPod( _mobIdHigh );
	str.readPod( _mobIdLow );
	str.readPod( _sourceTrack );
	str.readPod( _sourcePosition );
	
	readMobIdFromAObjDocStream( str, _mobId );
	
	str.readPod( tagMark );
	TR_ASSERT( tagMark == 0x03 );
}

#define TRACE_FIELD( x ) "\t" #x ": " << x << std::endl

void ASourceClip::dump( std::ostream& str ) const
{
	str << "ASourceClip {" << std::endl;
	
	AClip::dump( str );
	
	str << TRACE_FIELD( _mobIdHigh );
	str << TRACE_FIELD( _mobIdLow );
	str << TRACE_FIELD( _sourceTrack );
	str << TRACE_FIELD( _sourcePosition );
	str << TRACE_FIELD( _mobId );
	
	str << "}" << std::endl;
}